using System;
using System.Collections.Generic;
using System.Linq;
using Fuse8.ContentManagementFramework.Domain.Bases;
using Fuse8.ContentManagementFramework.Domain.Special;
using Fuse8.DomainFramework.Common.Locator;

namespace Fuse8.ContentManagementFramework.BizFacade.Services
{
    public class CmsEntityRevisionServiceFacade 
    {
        private IEnumerable<ICmsEntityRevisionService> Services 
        {
            get { return DependencyServiceLocator.Current.GetAllInstances<ICmsEntityRevisionService>(); }
        }
        
        public IEnumerable<CmsRevisionableEntityObject> FindAllDraftRevisions(SiteAwareCategory siteAwareCategory = SiteAwareCategory.Site)
        {
            return Services.SelectMany(e => e.FindAllDraftRevisions(siteAwareCategory));
        }

        public IEnumerable<CmsRevisionableEntityObject> FindAllActiveRevisions(SiteAwareCategory siteAwareCategory = SiteAwareCategory.Site)
        {
            return Services.SelectMany(e => e.FindAllActiveRevisions(siteAwareCategory));
        }

        public IEnumerable<CmsRevisionableEntityObject> FindAllApprovedRevisions(SiteAwareCategory siteAwareCategory = SiteAwareCategory.Site)
        {
            return Services.SelectMany(e => e.FindAllApprovedRevisions(siteAwareCategory));
        }
    }
}